package com.sugar.subscribe.course.module.business.controller.app.city;

import com.sugar.subscribe.course.framework.common.pojo.CommonResult;
import com.sugar.subscribe.course.module.business.controller.admin.city.vo.CityRespVO;
import com.sugar.subscribe.course.module.business.service.city.CityService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.util.List;

import static com.sugar.subscribe.course.framework.common.pojo.CommonResult.success;

@Tag(name = "APP - 城市")
@RestController
@RequestMapping("/biz/city")
@Validated
public class AppCityController {

    @Resource
    private CityService cityService;

    @GetMapping("/all")
    @Operation(summary = "获得所有城市")
    @PermitAll
    public CommonResult<List<CityRespVO>> getCityList() {
        return success(cityService.getCityList());
    }
}